/* 增强型段落编辑器样式 */

.enhanced-paragraph-editor {
  padding: 16px;
  background: #f5f5f5;
  min-height: calc(100vh - 120px);
}

/* 编辑器容器 */
.editor-container {
  position: relative;
  width: 100%;
}

/* 文本编辑区 */
.paragraph-textarea {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  font-size: 16px;
  line-height: 1.8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC',
    'Microsoft YaHei', sans-serif;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: white;
  resize: vertical;
  transition: all 0.3s;
}

.paragraph-textarea:focus {
  outline: none;
  border-color: #40a9ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 智能补全浮层 */
.completion-popup {
  position: absolute;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  max-width: 500px;
  margin-top: 4px;
}

.completion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
  color: #666;
}

.completion-list {
  max-height: 150px;
  overflow-y: auto;
}

.completion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.completion-item:hover {
  background: #f5f7fa;
}

.completion-text {
  flex: 1;
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-hint {
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 11px;
  color: #666;
  background: #f0f0f0;
  border-radius: 4px;
  font-family: monospace;
}

/* 字数统计栏 */
.word-count-bar {
  margin-top: 16px;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}

/* 移动端Copilot按钮 */
.mobile-copilot-button {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 4px 16px rgba(24, 144, 255, 0.4);
  }
  100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .enhanced-paragraph-editor {
    padding: 8px;
  }

  .paragraph-textarea {
    font-size: 14px;
    min-height: 300px;
    padding: 12px;
  }

  .completion-popup {
    left: 8px;
    right: 8px;
    max-width: none;
  }

  .word-count-bar {
    padding: 8px;
    font-size: 12px;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .enhanced-paragraph-editor {
    background: #1f1f1f;
  }

  .paragraph-textarea {
    background: #2a2a2a;
    color: #e8e8e8;
    border-color: #434343;
  }

  .paragraph-textarea:focus {
    border-color: #177ddc;
    box-shadow: 0 0 0 2px rgba(23, 125, 220, 0.2);
  }

  .completion-popup {
    background: #2a2a2a;
    border-color: #434343;
  }

  .completion-item:hover {
    background: #3a3a3a;
  }

  .completion-text {
    color: #e8e8e8;
  }

  .word-count-bar {
    background: #2a2a2a;
    border-color: #434343;
    color: #e8e8e8;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .paragraph-textarea {
    border-width: 2px;
  }

  .completion-popup {
    border-width: 2px;
  }
}

/* 动画效果 */
.completion-popup {
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 选中文本高亮 */
.paragraph-textarea::selection {
  background: rgba(24, 144, 255, 0.2);
}

.paragraph-textarea::-moz-selection {
  background: rgba(24, 144, 255, 0.2);
}

/* 滚动条美化 */
.paragraph-textarea::-webkit-scrollbar {
  width: 8px;
}

.paragraph-textarea::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.paragraph-textarea::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.paragraph-textarea::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 编辑器工具栏按钮组 */
.ant-card-head .ant-space {
  flex-wrap: wrap;
}

.ant-card-head .ant-btn {
  margin: 2px;
}

/* 优化卡片阴影 */
.enhanced-paragraph-editor .ant-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s;
}

.enhanced-paragraph-editor .ant-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}